#define _CRT_SECURE_NO_WARNINGS

//#include "process.h"
//
//int main()
//{
//    process_v1();
//    return 0;
//}


#include "process.h"

void download(callback_t cb)
{
    int testcnt = 100;
    int target = TARGET_SIZE;
    int total = 0;

    while (total <= target)
    {
        Sleep(sleep_time);
        total += DSIZE;
        double rate = total * 100.0 / target;
        if (rate > 50.0 && testcnt)
        {
            total = target / 2;
            testcnt--;
        }
        cb(rate);
    }
    cb(MAX_RATE);
    printf("\n");
}

int main()
{
    download(process_v2);
    return 0;
}
